package logic

import (
	"context"
	"doctor-medicine-system/models/mysql"

	"doctor-medicine-system/docrpc/docrpc"
	"doctor-medicine-system/docrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogic {
	return &ListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ListLogic) List(in *docrpc.ListRequest) (*docrpc.ListResponse, error) {
	// todo: add your logic here and delete this line
	var list []*docrpc.DrugList
	list = mysql.DrugList(mysql.DB)
	return &docrpc.ListResponse{
		List: list,
	}, nil
}
